/**
 * Created by Administrator on 2017/3/14.
 */
var RealName = require('../../src/complex/realName');
var FinanceDetail = require('../../src/complex/financeDetail');

var Root = React.createClass({
    getInitialState:function(){
        return{
            ProDetail:PageDM.ProDetail.value,
            realNameInfo:PageDM.realNameInfo.value
        }
    },
    componentDidMount: function(){
        var _this = this;
        var PageDM = window.PageDM;

        //项目详情
        UEventHub.on(PageDM.ProDetail.dmbind + UI_EVENT_CONST.SET_UDM_VALUE_EVENT, function(v){
            _this.setState({
                ProDetail:v
            })
        });
        //个人实名信息
        UEventHub.on(PageDM.realNameInfo.dmbind + UI_EVENT_CONST.SET_UDM_VALUE_EVENT, function(v){
            _this.setState({
                realNameInfo:v
            })
        });
        //URL
        UEventHub.on(PageDM.URL.dmbind + UI_EVENT_CONST.SET_UDM_VALUE_EVENT, function(v){
            var checkRef = _this.refs.detail.getRefs('agreement');
            if(checkRef){
                checkRef.setState({
                    url:v
                })
            }
        });
        UEventHub.emit("pageLoad","hello world!");
    },
    render: function () {

        return (
            <div>

                <div className="mod-account container">
                    <div className="sub-nav">
                        <RealName data={this.state.realNameInfo}/>
                    </div>
                    <div className="account">
                        <FinanceDetail ref="detail" url={PageDM.URL} ProDetail={this.state.ProDetail} exportPDF={PageDM.exportPDF} printBtn={PageDM.printBtn}/>
                    </div>
                    <div className="clear"></div>
                </div>

            </div>
        )
    }
});
ReactDOM.render(<Root/>, document.getElementById('giraffe'));